"
" vim: ft=vim
" Test hasattr()
"

Execute(Returns 1 when object is a Dict and it has that attribute);
let obj = { 'count' : 22, 'line' : 100, 'pos' : 10 }
Assert object#hasattr(obj, 'count')
Assert object#hasattr(obj, 'line')
Assert object#hasattr(obj, 'pos')

Execute(Return 0 when object is not a Dict or does not have that attribute);
Assert !object#hasattr([], 'length')
Assert !object#hasattr('', 'toupper')
Assert !object#hasattr(30, 'digits')
Assert !object#hasattr({'gender' : 'male'}, 'age')

Execute(Throw TypeError with non-String name);
AssertThrows call object#hasattr({}, 1)
Log g:vader_exception
Assert g:vader_exception =~# 'TypeError'
